Kaydet (Commit) 6b7d4109 authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Miklos Vajna

lool - page border shadow can be disabled

Support for text documents and presentations.

Added a command line option for gtktiledviewer:
--hide-page-shadow.

Reviewed on:
	https://gerrit.libreoffice.org/21210

Change-Id: I1e427693d7af40cb5731d1730ac5b7c486d45c29
üst 1f1ddaad
......@@ -162,6 +162,7 @@ protected:
SvtOptionsDrawinglayer maDrawinglayerOpt;
bool mbPageVisible : 1;
bool mbPageShadowVisible : 1;
bool mbPageBorderVisible : 1;
bool mbBordVisible : 1;
bool mbGridVisible : 1;
......@@ -372,6 +373,9 @@ public:
/// Draw Page as a white area or not
bool IsPageVisible() const { return mbPageVisible; }
/// Draw Page shadow or not
bool IsPageShadowVisible() const { return mbPageShadowVisible; }
/// Draw Page as a white area or not
bool IsPageBorderVisible() const { return mbPageBorderVisible; }
......@@ -392,6 +396,7 @@ public:
Color GetGridColor() const { return maGridColor;}
void SetPageVisible(bool bOn = true) { mbPageVisible=bOn; InvalidateAllWin(); }
void SetPageShadowVisible(bool bOn = true) { mbPageShadowVisible=bOn; InvalidateAllWin(); }
void SetPageBorderVisible(bool bOn = true) { mbPageBorderVisible=bOn; InvalidateAllWin(); }
void SetBordVisible(bool bOn = true) { mbBordVisible=bOn; InvalidateAllWin(); }
void SetGridVisible(bool bOn = true) { mbGridVisible=bOn; InvalidateAllWin(); }
......
......@@ -32,8 +32,9 @@ static int help()
{
fprintf(stderr, "Usage: gtktiledviewer <absolute-path-to-libreoffice-install's-program-directory> <path-to-document> [<options> ... ]\n\n");
fprintf(stderr, "Options:\n\n");
fprintf(stderr, "--hide-whitespace: Hide whitespace between pages in text documents.\n");
fprintf(stderr, "--background-color <color>: Set custom background color, e.g. 'yellow'.\n");
fprintf(stderr, "--hide-page-shadow: Hide page/slide shadow.\n");
fprintf(stderr, "--hide-whitespace: Hide whitespace between pages in text documents.\n");
return 1;
}
......@@ -507,12 +508,7 @@ static void createModelAndView(const char* pLOPath, const char* pDocPath, const
for (size_t i = 0; i < rArguments.size(); ++i)
{
const std::string& rArgument = rArguments[i];
if (rArgument == "--hide-whitespace")
{
aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/type", '/'), "boolean");
aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/value", '/'), true);
}
else if (rArgument == "--background-color" && i + 1 < rArguments.size())
if (rArgument == "--background-color" && i + 1 < rArguments.size())
{
GdkRGBA color;
gdk_rgba_parse(&color, rArguments[i + 1].c_str());
......@@ -520,7 +516,18 @@ static void createModelAndView(const char* pLOPath, const char* pDocPath, const
gtk_widget_override_background_color(gtk_widget_get_toplevel(pDocView), GTK_STATE_FLAG_NORMAL, &color);
SAL_WNODEPRECATED_DECLARATIONS_POP
}
else if (rArgument == "--hide-page-shadow")
{
aTree.put(boost::property_tree::ptree::path_type(".uno:ShowBorderShadow/type", '/'), "boolean");
aTree.put(boost::property_tree::ptree::path_type(".uno:ShowBorderShadow/value", '/'), false);
}
else if (rArgument == "--hide-whitespace")
{
aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/type", '/'), "boolean");
aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/value", '/'), true);
}
}
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTree);
std::string aArguments = aStream.str();
......
......@@ -2359,7 +2359,7 @@ Size SdXImpressDocument::getDocumentSize()
return Size(convertMm100ToTwip(aSize.getWidth()), convertMm100ToTwip(aSize.getHeight()));
}
void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/)
void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
{
SolarMutexGuard aGuard;
......@@ -2371,6 +2371,13 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
if (DrawViewShell* pViewShell = GetViewShell())
{
DrawView* pDrawView = pViewShell->GetDrawView();
for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
{
const beans::PropertyValue& rValue = rArguments[i];
if (rValue.Name == ".uno:ShowBorderShadow" && rValue.Value.has<bool>())
pDrawView->SetPageShadowVisible(rValue.Value.get<bool>());
}
// Disable map mode, so that it's possible to send mouse event coordinates
// in logic units.
if (sd::Window* pWindow = pViewShell->GetActiveWindow())
......@@ -2383,7 +2390,7 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
// (whereas with async loading images start being loaded after
// we have painted the tile, resulting in an invalidate, followed
// by the tile being rerendered - which is wasteful and ugly).
pViewShell->GetDrawView()->SetSwapAsynchron(false);
pDrawView->SetSwapAsynchron(false);
}
}
......
......@@ -266,6 +266,11 @@ bool ViewObjectContactOfPageShadow::isPrimitiveVisible(const DisplayInfo& rDispl
return false;
}
if(!pSdrPageView->GetView().IsPageShadowVisible())
{
return false;
}
// no page shadow for preview renderers
if(GetObjectContact().IsPreviewRenderer())
{
......
......@@ -163,6 +163,7 @@ void SdrPaintView::ImpClearVars()
mpItemBrowser=nullptr;
#endif
mbPageVisible=true;
mbPageShadowVisible=true;
mbPageBorderVisible=true;
mbBordVisible=true;
mbGridVisible=true;
......
......@@ -3225,6 +3225,8 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::
const beans::PropertyValue& rValue = rArguments[i];
if (rValue.Name == ".uno:HideWhitespace" && rValue.Value.has<bool>())
aViewOption.SetHideWhitespaceMode(rValue.Value.get<bool>());
else if (rValue.Name == ".uno:ShowBorderShadow" && rValue.Value.has<bool>())
SwViewOption::SetAppearanceFlag(VIEWOPT_SHADOW , rValue.Value.get<bool>());
}
pViewShell->ApplyViewOptions(aViewOption);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment