[Libreoffice-commits] core.git: 2 commits - include/tools officecfg/registry sfx2/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Tue Apr 21 01:29:45 PDT 2015
include/tools/color.hxx | 170 +++++-----
officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs | 16
sfx2/source/sidebar/DeckDescriptor.cxx | 8
sfx2/source/sidebar/DeckDescriptor.hxx | 17 -
sfx2/source/sidebar/PanelDescriptor.cxx | 6
sfx2/source/sidebar/PanelDescriptor.hxx | 15
sfx2/source/sidebar/ResourceManager.cxx | 15
sfx2/source/sidebar/ResourceManager.hxx | 3
8 files changed, 158 insertions(+), 92 deletions(-)
New commits:
commit 0e8218d9d880fa4be972de3decd9cd42f55472c3
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue Apr 21 17:23:26 2015 +0900
sidebar panel or deck can now be marked as experimental
.. so they show up only when experimental mode is enabled.
Change-Id: Ib89b8b03290b7c04edc4da48ed328f03cd88d02c
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
index 1039bec..d5b90e0 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -97,8 +97,8 @@
DrawImpress
WriterVariants
These shortcuts exist for even more convenience and handle the frequent case of Draw
- and Impress as well as different variants of the Writer where they have otherwise
- identical context descriptions.
+ and Impress as well as different variants of the Writer where they have otherwise
+ identical context descriptions.
Special values:
any
@@ -128,6 +128,12 @@
</info>
<value>10000</value>
</prop>
+ <prop oor:name="IsExperimental" oor:type="xs:boolean">
+ <info>
+ <desc>This flag controls whether the deck is experimental and is shown only when experimental mode is enabled.</desc>
+ </info>
+ <value>false</value>
+ </prop>
</group>
<group oor:name="Panel">
<info>
@@ -214,6 +220,12 @@
</info>
<value>false</value>
</prop>
+ <prop oor:name="IsExperimental" oor:type="xs:boolean">
+ <info>
+ <desc>This flag controls whether the panel is experimental and is shown only when experimental mode is enabled.</desc>
+ </info>
+ <value>false</value>
+ </prop>
</group>
</templates>
<component>
diff --git a/sfx2/source/sidebar/DeckDescriptor.cxx b/sfx2/source/sidebar/DeckDescriptor.cxx
index 9981b79..2f431e5 100644
--- a/sfx2/source/sidebar/DeckDescriptor.cxx
+++ b/sfx2/source/sidebar/DeckDescriptor.cxx
@@ -32,7 +32,8 @@ DeckDescriptor::DeckDescriptor()
msHelpText(),
maContextList(),
mbIsEnabled(true),
- mnOrderIndex(10000) // Default value as defined in Sidebar.xcs
+ mnOrderIndex(10000), // Default value as defined in Sidebar.xcs
+ mbExperimental(false)
{
}
@@ -46,8 +47,9 @@ DeckDescriptor::DeckDescriptor (const DeckDescriptor& rOther)
msHelpURL(rOther.msHelpURL),
msHelpText(rOther.msHelpText),
maContextList(rOther.maContextList),
- mbIsEnabled(rOther.mbIsEnabled),
- mnOrderIndex(rOther.mnOrderIndex)
+ mbIsEnabled(rOther.mbIsEnabled),
+ mnOrderIndex(rOther.mnOrderIndex),
+ mbExperimental(rOther.mbExperimental)
{
}
diff --git a/sfx2/source/sidebar/DeckDescriptor.hxx b/sfx2/source/sidebar/DeckDescriptor.hxx
index 3ea1db1..77f811e 100644
--- a/sfx2/source/sidebar/DeckDescriptor.hxx
+++ b/sfx2/source/sidebar/DeckDescriptor.hxx
@@ -28,17 +28,18 @@ namespace sfx2 { namespace sidebar {
class DeckDescriptor
{
public:
- ::rtl::OUString msTitle;
- ::rtl::OUString msId;
- ::rtl::OUString msIconURL;
- ::rtl::OUString msHighContrastIconURL;
- ::rtl::OUString msTitleBarIconURL;
- ::rtl::OUString msHighContrastTitleBarIconURL;
- ::rtl::OUString msHelpURL;
- ::rtl::OUString msHelpText;
+ OUString msTitle;
+ OUString msId;
+ OUString msIconURL;
+ OUString msHighContrastIconURL;
+ OUString msTitleBarIconURL;
+ OUString msHighContrastTitleBarIconURL;
+ OUString msHelpURL;
+ OUString msHelpText;
ContextList maContextList;
bool mbIsEnabled;
sal_Int32 mnOrderIndex;
+ bool mbExperimental;
DeckDescriptor();
DeckDescriptor (const DeckDescriptor& rOther);
diff --git a/sfx2/source/sidebar/PanelDescriptor.cxx b/sfx2/source/sidebar/PanelDescriptor.cxx
index c7837bf..c88f21b 100644
--- a/sfx2/source/sidebar/PanelDescriptor.cxx
+++ b/sfx2/source/sidebar/PanelDescriptor.cxx
@@ -33,7 +33,8 @@ PanelDescriptor::PanelDescriptor()
msImplementationURL(),
mnOrderIndex(10000), // Default value as defined in Sidebar.xcs
mbShowForReadOnlyDocuments(false),
- mbWantsCanvas(false)
+ mbWantsCanvas(false),
+ mbExperimental(false)
{
}
@@ -49,7 +50,8 @@ PanelDescriptor::PanelDescriptor (const PanelDescriptor& rOther)
msImplementationURL(rOther.msImplementationURL),
mnOrderIndex(rOther.mnOrderIndex),
mbShowForReadOnlyDocuments(rOther.mbShowForReadOnlyDocuments),
- mbWantsCanvas(rOther.mbWantsCanvas)
+ mbWantsCanvas(rOther.mbWantsCanvas),
+ mbExperimental(rOther.mbExperimental)
{
}
diff --git a/sfx2/source/sidebar/PanelDescriptor.hxx b/sfx2/source/sidebar/PanelDescriptor.hxx
index d1a20d2..f67a128 100644
--- a/sfx2/source/sidebar/PanelDescriptor.hxx
+++ b/sfx2/source/sidebar/PanelDescriptor.hxx
@@ -28,18 +28,19 @@ namespace sfx2 { namespace sidebar {
class PanelDescriptor
{
public:
- ::rtl::OUString msTitle;
+ OUString msTitle;
bool mbIsTitleBarOptional;
- ::rtl::OUString msId;
- ::rtl::OUString msDeckId;
- ::rtl::OUString msTitleBarIconURL;
- ::rtl::OUString msHighContrastTitleBarIconURL;
- ::rtl::OUString msHelpURL;
+ OUString msId;
+ OUString msDeckId;
+ OUString msTitleBarIconURL;
+ OUString msHighContrastTitleBarIconURL;
+ OUString msHelpURL;
ContextList maContextList;
- ::rtl::OUString msImplementationURL;
+ OUString msImplementationURL;
sal_Int32 mnOrderIndex;
bool mbShowForReadOnlyDocuments;
bool mbWantsCanvas;
+ bool mbExperimental;
PanelDescriptor();
PanelDescriptor (const PanelDescriptor& rPanelDescriptor);
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index c5bfa88..b998e24 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -47,7 +47,8 @@ ResourceManager& ResourceManager::Instance()
ResourceManager::ResourceManager()
: maDecks(),
maPanels(),
- maProcessedApplications()
+ maProcessedApplications(),
+ maMiscOptions()
{
ReadDeckList();
ReadPanelList();
@@ -68,6 +69,8 @@ const DeckDescriptor* ResourceManager::GetDeckDescriptor (
iDeck!=iEnd;
++iDeck)
{
+ if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+ continue;
if (iDeck->msId.equals(rsDeckId))
return &*iDeck;
}
@@ -99,6 +102,8 @@ void ResourceManager::SetIsDeckEnabled (
iDeck!=iEnd;
++iDeck)
{
+ if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+ continue;
if (iDeck->msId.equals(rsDeckId))
{
iDeck->mbIsEnabled = bIsEnabled;
@@ -122,6 +127,8 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
iDeck!=iEnd;
++iDeck)
{
+ if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+ continue;
const DeckDescriptor& rDeckDescriptor (*iDeck);
if (rDeckDescriptor.maContextList.GetMatch(rContext) == NULL)
continue;
@@ -163,6 +170,8 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc
++iPanel)
{
const PanelDescriptor& rPanelDescriptor (*iPanel);
+ if (rPanelDescriptor.mbExperimental && !maMiscOptions.IsExperimentalMode())
+ continue;
if ( ! rPanelDescriptor.msDeckId.equals(rsDeckId))
continue;
@@ -231,6 +240,8 @@ void ResourceManager::ReadDeckList()
rDeckDescriptor.mbIsEnabled = true;
rDeckDescriptor.mnOrderIndex = ::comphelper::getINT32(
aDeckNode.getNodeValue("OrderIndex"));
+ rDeckDescriptor.mbExperimental = ::comphelper::getBOOL(
+ aDeckNode.getNodeValue("IsExperimental"));
ReadContextList(
aDeckNode,
@@ -287,6 +298,8 @@ void ResourceManager::ReadPanelList()
aPanelNode.getNodeValue("ShowForReadOnlyDocument"));
rPanelDescriptor.mbWantsCanvas = ::comphelper::getBOOL(
aPanelNode.getNodeValue("WantsCanvas"));
+ rPanelDescriptor.mbExperimental = ::comphelper::getBOOL(
+ aPanelNode.getNodeValue("IsExperimental"));
const OUString sDefaultMenuCommand (::comphelper::getString(
aPanelNode.getNodeValue("DefaultMenuCommand")));
diff --git a/sfx2/source/sidebar/ResourceManager.hxx b/sfx2/source/sidebar/ResourceManager.hxx
index 57fc5be..a358271 100644
--- a/sfx2/source/sidebar/ResourceManager.hxx
+++ b/sfx2/source/sidebar/ResourceManager.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <set>
#include <boost/shared_ptr.hpp>
+#include <svtools/miscopt.hxx>
namespace sfx2 { namespace sidebar {
@@ -105,6 +106,8 @@ private:
PanelContainer maPanels;
mutable ::std::set<rtl::OUString> maProcessedApplications;
+ SvtMiscOptions maMiscOptions;
+
void ReadDeckList();
void ReadPanelList();
void ReadContextList (
commit ef968e133f8da87b960ab0f0627cc8bcc691d9cb
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue Apr 21 14:00:03 2015 +0900
cleanup tools/color.hxx
Change-Id: I7d8f263f9ccb1ea4f230d7a2df4d88c408b3a5da
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index 92ea210..f940dbc 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -91,88 +91,120 @@ typedef sal_uInt32 ColorData;
class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Color
{
protected:
- ColorData mnColor;
+ ColorData mnColor;
public:
- Color() { mnColor = COL_BLACK; }
- Color( ColorData nColor ) { mnColor = nColor; }
- Color( sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue )
- { mnColor = RGB_COLORDATA( nRed, nGreen, nBlue ); }
- Color( sal_uInt8 nTransparency, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue )
- { mnColor = TRGB_COLORDATA( nTransparency, nRed, nGreen, nBlue ); }
- // This ctor is defined in svtools, not tools!
- Color( const ResId& rResId );
-
- // constructor to create a tools-Color from ::basegfx::BColor
- explicit Color(const ::basegfx::BColor& rBColor)
- {
- mnColor = RGB_COLORDATA(
- sal_uInt8((rBColor.getRed() * 255.0) + 0.5),
+ Color()
+ : mnColor(COL_BLACK)
+ {}
+ Color(ColorData nColor)
+ : mnColor(nColor)
+ {}
+ Color(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ : mnColor(RGB_COLORDATA(nRed, nGreen, nBlue))
+ {}
+ Color(sal_uInt8 nTransparency, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ : mnColor(TRGB_COLORDATA(nTransparency, nRed, nGreen, nBlue))
+ {}
+ // This ctor is defined in svtools, not tools!
+ Color(const ResId& rResId);
+
+ // constructor to create a tools-Color from ::basegfx::BColor
+ explicit Color(const basegfx::BColor& rBColor)
+ : mnColor(RGB_COLORDATA(sal_uInt8((rBColor.getRed() * 255.0) + 0.5),
sal_uInt8((rBColor.getGreen() * 255.0) + 0.5),
- sal_uInt8((rBColor.getBlue() * 255.0) + 0.5));
- }
-
- bool operator<(const Color& b) const
- {
- return mnColor < b.GetColor();
- }
-
- void SetRed( sal_uInt8 nRed );
- sal_uInt8 GetRed() const { return COLORDATA_RED( mnColor ); }
- void SetGreen( sal_uInt8 nGreen );
- sal_uInt8 GetGreen() const { return COLORDATA_GREEN( mnColor ); }
- void SetBlue( sal_uInt8 nBlue );
- sal_uInt8 GetBlue() const { return COLORDATA_BLUE( mnColor ); }
- void SetTransparency( sal_uInt8 nTransparency );
- sal_uInt8 GetTransparency() const { return COLORDATA_TRANSPARENCY( mnColor ); }
-
- void SetColor( ColorData nColor ) { mnColor = nColor; }
- ColorData GetColor() const { return mnColor; }
- ColorData GetRGBColor() const { return COLORDATA_RGB( mnColor ); }
-
- sal_uInt8 GetColorError( const Color& rCompareColor ) const;
-
- sal_uInt8 GetLuminance() const;
- void IncreaseLuminance( sal_uInt8 cLumInc );
- void DecreaseLuminance( sal_uInt8 cLumDec );
-
- void DecreaseContrast( sal_uInt8 cContDec );
-
- void Invert();
-
- void Merge( const Color& rMergeColor, sal_uInt8 cTransparency );
-
- bool IsRGBEqual( const Color& rColor ) const;
+ sal_uInt8((rBColor.getBlue() * 255.0) + 0.5)))
+ {}
+
+ bool operator<(const Color& b) const
+ {
+ return mnColor < b.GetColor();
+ }
+
+ void SetRed(sal_uInt8 nRed);
+ sal_uInt8 GetRed() const
+ {
+ return COLORDATA_RED(mnColor);
+ }
+ void SetGreen(sal_uInt8 nGreen);
+ sal_uInt8 GetGreen() const
+ {
+ return COLORDATA_GREEN(mnColor);
+ }
+ void SetBlue(sal_uInt8 nBlue);
+ sal_uInt8 GetBlue() const
+ {
+ return COLORDATA_BLUE(mnColor);
+ }
+ void SetTransparency(sal_uInt8 nTransparency);
+ sal_uInt8 GetTransparency() const
+ {
+ return COLORDATA_TRANSPARENCY(mnColor);
+ }
+
+ void SetColor(ColorData nColor)
+ {
+ mnColor = nColor;
+ }
+ ColorData GetColor() const
+ {
+ return mnColor;
+ }
+ ColorData GetRGBColor() const
+ {
+ return COLORDATA_RGB(mnColor);
+ }
+
+ sal_uInt8 GetColorError(const Color& rCompareColor) const;
+
+ sal_uInt8 GetLuminance() const;
+ void IncreaseLuminance(sal_uInt8 cLumInc);
+ void DecreaseLuminance(sal_uInt8 cLumDec);
+
+ void DecreaseContrast(sal_uInt8 cContDec);
+
+ void Invert();
+
+ void Merge(const Color& rMergeColor, sal_uInt8 cTransparency);
+
+ bool IsRGBEqual(const Color& rColor) const;
// comparison with luminance thresholds
- bool IsDark() const;
- bool IsBright() const;
+ bool IsDark() const;
+ bool IsBright() const;
// color space conversion tools
// the range for h/s/b is:
// Hue: 0-360 degree
// Saturation: 0-100%
// Brightness: 0-100%
- static ColorData HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri );
- void RGBtoHSB( sal_uInt16& nHue, sal_uInt16& nSat, sal_uInt16& nBri ) const;
+ static ColorData HSBtoRGB(sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness);
+ void RGBtoHSB(sal_uInt16& nHue, sal_uInt16& nSaturation, sal_uInt16& nBrightness) const;
- bool operator==( const Color& rColor ) const
- { return (mnColor == rColor.mnColor); }
- bool operator!=( const Color& rColor ) const
- { return !(Color::operator==( rColor )); }
+ bool operator==(const Color& rColor) const
+ {
+ return mnColor == rColor.mnColor;
+ }
+ bool operator!=(const Color& rColor) const
+ {
+ return !(Color::operator==(rColor));
+ }
- SvStream& Read( SvStream& rIStm, bool bNewFormat = true );
- SvStream& Write( SvStream& rOStm, bool bNewFormat = true );
+ SvStream& Read(SvStream& rIStream, bool bNewFormat = true);
+ SvStream& Write(SvStream& rOStream, bool bNewFormat = true);
- TOOLS_DLLPUBLIC friend SvStream& ReadColor( SvStream& rIStream, Color& rColor );
- TOOLS_DLLPUBLIC friend SvStream& WriteColor( SvStream& rOStream, const Color& rColor );
+ TOOLS_DLLPUBLIC friend SvStream& ReadColor(SvStream& rIStream, Color& rColor);
+ TOOLS_DLLPUBLIC friend SvStream& WriteColor(SvStream& rOStream, const Color& rColor);
// Return color as RGB hex string
// for example "00ff00" for green color
OUString AsRGBHexString() const;
// get ::basegfx::BColor from this color
- ::basegfx::BColor getBColor() const { return ::basegfx::BColor(GetRed() / 255.0, GetGreen() / 255.0, GetBlue() / 255.0); }
+ basegfx::BColor getBColor() const
+ {
+ return basegfx::BColor(GetRed() / 255.0, GetGreen() / 255.0, GetBlue() / 255.0);
+ }
};
inline void Color::SetRed( sal_uInt8 nRed )
@@ -201,21 +233,21 @@ inline void Color::SetTransparency( sal_uInt8 nTransparency )
inline bool Color::IsRGBEqual( const Color& rColor ) const
{
- return (COLORDATA_RGB( mnColor ) == COLORDATA_RGB( rColor.mnColor ));
+ return COLORDATA_RGB( mnColor ) == COLORDATA_RGB(rColor.mnColor);
}
inline sal_uInt8 Color::GetLuminance() const
{
- return( (sal_uInt8) ( ( COLORDATA_BLUE( mnColor ) * 29UL +
- COLORDATA_GREEN( mnColor ) * 151UL +
- COLORDATA_RED( mnColor ) * 76UL ) >> 8UL ) );
+ return static_cast<sal_uInt8>((COLORDATA_BLUE(mnColor) * 29UL +
+ COLORDATA_GREEN(mnColor) * 151UL +
+ COLORDATA_RED(mnColor) * 76UL) >> 8UL);
}
inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency )
{
- SetRed( COLOR_CHANNEL_MERGE( COLORDATA_RED( mnColor ), COLORDATA_RED( rMergeColor.mnColor ), cTransparency ) );
- SetGreen( COLOR_CHANNEL_MERGE( COLORDATA_GREEN( mnColor ), COLORDATA_GREEN( rMergeColor.mnColor ), cTransparency ) );
- SetBlue( COLOR_CHANNEL_MERGE( COLORDATA_BLUE( mnColor ), COLORDATA_BLUE( rMergeColor.mnColor ), cTransparency ) );
+ SetRed(COLOR_CHANNEL_MERGE(COLORDATA_RED(mnColor), COLORDATA_RED(rMergeColor.mnColor), cTransparency));
+ SetGreen(COLOR_CHANNEL_MERGE(COLORDATA_GREEN(mnColor), COLORDATA_GREEN(rMergeColor.mnColor), cTransparency));
+ SetBlue(COLOR_CHANNEL_MERGE(COLORDATA_BLUE(mnColor), COLORDATA_BLUE(rMergeColor.mnColor), cTransparency));
}
#endif
More information about the Libreoffice-commits
mailing list