[Libreoffice-commits] core.git: 2 commits - cui/source include/unotools officecfg/registry sfx2/source unotools/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Mar 2 12:37:33 UTC 2016


 cui/source/inc/cuires.hrc                                  |    1 
 cui/source/options/optpath.cxx                             |   11 +++++++-
 cui/source/options/optpath.src                             |    4 +++
 include/unotools/pathoptions.hxx                           |    3 ++
 officecfg/registry/data/org/openoffice/Office/Paths.xcu    |   10 ++++++++
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   12 ---------
 sfx2/source/view/classificationhelper.cxx                  |    6 ++--
 unotools/source/config/pathoptions.cxx                     |   16 ++++++++++++-
 8 files changed, 45 insertions(+), 18 deletions(-)

New commits:
commit 87629f39bbae1ad774d588c50d030bff0ba8d8a2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 2 12:26:06 2016 +0100

    cui: show classification path in SvxPathTabPage
    
    It's not really able to modify it yet, as it wants to select a
    directory, and we need a file instead.
    
    Change-Id: I05b0e5a42ef64e56caeae35054fb331e3f1a712c

diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index e99045d..f9b2843 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -163,6 +163,7 @@
 #define RID_SVXSTR_KEY_BASIC_PATH           (RID_SVX_START + 1007)//?
 #define RID_SVXSTR_KEY_BITMAP_PATH          (RID_SVX_START + 1008)//?
 #define RID_SVXSTR_KEY_USERDICTIONARY_DIR   (RID_SVX_START + 1025)//?
+#define RID_SVXSTR_KEY_CLASSIFICATION_PATH  (RID_SVX_START + 1118)
 
 // dialogs
 #define STR_MODIFY                          (RID_SVX_START + 336)//from optdict.src
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index f8215a6..d1951f7 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -115,6 +115,7 @@ static Handle2CfgNameMapping_Impl const Hdl2CfgMap_Impl[] =
     { SvtPathOptions::PATH_TEMPLATE,    "Template" },
     { SvtPathOptions::PATH_WORK,        "Work" },
     { SvtPathOptions::PATH_DICTIONARY,        "Dictionary" },
+    { SvtPathOptions::PATH_CLASSIFICATION, "Classification" },
 #if OSL_DEBUG_LEVEL > 1
     { SvtPathOptions::PATH_LINGUISTIC,        "Linguistic" },
 #endif
@@ -282,7 +283,7 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
     long nWidth1 = rBar.GetTextWidth(rBar.GetItemText(1));
     long nWidth2 = rBar.GetTextWidth(rBar.GetItemText(2));
 
-    for( sal_uInt16 i = 0; i <= (sal_uInt16)SvtPathOptions::PATH_WORK; ++i )
+    for( sal_uInt16 i = 0; i <= (sal_uInt16)SvtPathOptions::PATH_CLASSIFICATION; ++i )
     {
         // only writer uses autotext
         if ( i == SvtPathOptions::PATH_AUTOTEXT
@@ -299,12 +300,18 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
             case SvtPathOptions::PATH_TEMP:
             case SvtPathOptions::PATH_TEMPLATE:
             case SvtPathOptions::PATH_DICTIONARY:
+            case SvtPathOptions::PATH_CLASSIFICATION:
 #if OSL_DEBUG_LEVEL > 1
             case SvtPathOptions::PATH_LINGUISTIC:
 #endif
             case SvtPathOptions::PATH_WORK:
             {
-                OUString aStr( CUI_RES( RID_SVXSTR_PATH_NAME_START + i ) );
+                sal_uInt32 nId = RID_SVXSTR_PATH_NAME_START + i;
+                if (i == SvtPathOptions::PATH_CLASSIFICATION)
+                    // RID_SVXSTR_KEY_USERDICTIONARY_DIR already took our slot, so name the key explicitly.
+                    nId = RID_SVXSTR_KEY_CLASSIFICATION_PATH;
+                OUString aStr(CUI_RES(nId));
+
                 nWidth1 = std::max(nWidth1, pPathBox->GetTextWidth(aStr));
                 aStr += "\t";
                 OUString sInternal, sUser, sWritable;
diff --git a/cui/source/options/optpath.src b/cui/source/options/optpath.src
index 95f5203..8eae971 100644
--- a/cui/source/options/optpath.src
+++ b/cui/source/options/optpath.src
@@ -104,6 +104,10 @@ String RID_SVXSTR_KEY_USERDICTIONARY_DIR
 {
     Text [ en-US ] = "User-defined dictionaries";
 };
+String RID_SVXSTR_KEY_CLASSIFICATION_PATH
+{
+    Text [ en-US ] = "Classification" ;
+};
 String RID_SVXSTR_KEY_AUTOCORRECT_DIR
 {
     Text [ en-US ] = "AutoCorrect";
diff --git a/include/unotools/pathoptions.hxx b/include/unotools/pathoptions.hxx
index ceaee00..1b311ec 100644
--- a/include/unotools/pathoptions.hxx
+++ b/include/unotools/pathoptions.hxx
@@ -58,9 +58,9 @@ public:
         PATH_TEMPLATE,
         PATH_USERCONFIG,
         PATH_WORK,
+        PATH_CLASSIFICATION,
         PATH_UICONFIG,
         PATH_FINGERPRINT,
-        PATH_CLASSIFICATION,
         PATH_COUNT // should always be the last element
     };
 
commit bf1721917c3dd565c102fc14e977cfd3cab1fa0e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 2 11:45:45 2016 +0100

    sfx2 classification: use SvtPathOptions
    
    In preparation to be able to edit the policy path from SvxPathTabPage.
    
    Change-Id: I7a8e03e9acf2e8096a5e00d1424c75fe31735c1d

diff --git a/include/unotools/pathoptions.hxx b/include/unotools/pathoptions.hxx
index f69954e..ceaee00 100644
--- a/include/unotools/pathoptions.hxx
+++ b/include/unotools/pathoptions.hxx
@@ -60,6 +60,7 @@ public:
         PATH_WORK,
         PATH_UICONFIG,
         PATH_FINGERPRINT,
+        PATH_CLASSIFICATION,
         PATH_COUNT // should always be the last element
     };
 
@@ -91,6 +92,7 @@ public:
     const OUString& GetWorkPath() const;
     const OUString& GetUIConfigPath() const;
     const OUString& GetFingerprintPath() const;
+    const OUString& GetClassificationPath() const;
 
     // set the paths
     void            SetAddinPath( const OUString& rPath );
@@ -115,6 +117,7 @@ public:
     void            SetTemplatePath( const OUString& rPath );
     void            SetUserConfigPath( const OUString& rPath );
     void            SetWorkPath( const OUString& rPath );
+    void            SetClassificationPath( const OUString& rPath );
 
     OUString        SubstituteVariable( const OUString& rVar ) const;
     OUString        ExpandMacros( const OUString& rPath ) const;
diff --git a/officecfg/registry/data/org/openoffice/Office/Paths.xcu b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
index 965a629..55db320 100644
--- a/officecfg/registry/data/org/openoffice/Office/Paths.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
@@ -206,6 +206,16 @@
         <value>$(work)</value>
       </prop>
     </node>
+    <node oor:name="Classification" oor:op="fuse" oor:mandatory="true">
+      <prop oor:name="IsSinglePath" oor:finalized="true">
+        <value>true</value>
+      </prop>
+      <node oor:name="InternalPaths" oor:finalized="true"/>
+      <prop oor:name="UserPaths" oor:finalized="true"/>
+      <prop oor:name="WritePath">
+        <value>$(insturl)/@LIBO_SHARE_FOLDER@/classification/example.xml</value>
+      </prop>
+    </node>
   </node>
   <node oor:name="Variables">
     <prop oor:name="Work">
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 9ce22f1..e06114e 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -1580,12 +1580,6 @@
           </info>
           <value>$(insturl)/@LIBO_SHARE_FOLDER@/config/symbol</value>
         </prop>
-        <prop oor:name="Classification" oor:type="xs:string" oor:nillable="false">
-          <info>
-            <desc>Contains the URL of the current TSCP BAF policy file.</desc>
-          </info>
-	  <value>$BRAND_BASE_DIR/@LIBO_SHARE_FOLDER@/classification/example.xml</value>
-        </prop>
         <prop oor:name="Config" oor:type="xs:string" oor:nillable="false">
           <info>
             <desc>Contains the configuration files. This value cannot be changed
@@ -1781,12 +1775,6 @@
           </info>
           <value>$(insturl)/@LIBO_SHARE_FOLDER@/config/symbol</value>
         </prop>
-        <prop oor:name="Classification" oor:type="xs:string" oor:nillable="false">
-          <info>
-            <desc>Contains the URL of the default TSCP BAF policy file.</desc>
-          </info>
-	  <value>$BRAND_BASE_DIR/@LIBO_SHARE_FOLDER@/classification/example.xml</value>
-        </prop>
         <prop oor:name="Config" oor:type="xs:string" oor:nillable="false">
           <info>
             <desc>Specifies the default directory where the configuration files
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index cade650..f086ade 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -22,7 +22,7 @@
 #include <sfx2/objsh.hxx>
 #include <o3tl/make_unique.hxx>
 #include <comphelper/processfactory.hxx>
-#include <rtl/bootstrap.hxx>
+#include <unotools/pathoptions.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/streamwrap.hxx>
 #include <cppuhelper/implbase.hxx>
@@ -311,8 +311,8 @@ SfxClassificationHelper::Impl::Impl(SfxObjectShell& rObjectShell)
 void SfxClassificationHelper::Impl::parsePolicy()
 {
     uno::Reference<uno::XComponentContext> xComponentContext = comphelper::getProcessComponentContext();
-    OUString aPath = officecfg::Office::Common::Path::Current::Classification::get(xComponentContext);
-    rtl::Bootstrap::expandMacros(aPath);
+    SvtPathOptions aOptions;
+    OUString aPath = aOptions.GetClassificationPath();
     SvStream* pStream = utl::UcbStreamHelper::CreateStream(aPath, StreamMode::READ);
     uno::Reference<io::XInputStream> xInputStream(new utl::OStreamWrapper(*pStream));
     xml::sax::InputSource aParserInput;
diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx
index 42fcd81..13fa335 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -126,6 +126,7 @@ class SvtPathOptions_Impl
         const OUString& GetWorkPath() { return GetPath( SvtPathOptions::PATH_WORK ); }
         const OUString& GetUIConfigPath() { return GetPath( SvtPathOptions::PATH_UICONFIG ); }
         const OUString& GetFingerprintPath() { return GetPath( SvtPathOptions::PATH_FINGERPRINT ); }
+        const OUString& GetClassificationPath() { return GetPath( SvtPathOptions::PATH_CLASSIFICATION ); }
 
         // set the paths
         void            SetPath( SvtPathOptions::Paths, const OUString& rNewPath );
@@ -151,6 +152,7 @@ class SvtPathOptions_Impl
         void            SetTemplatePath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_TEMPLATE, rPath ); }
         void            SetUserConfigPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_USERCONFIG, rPath ); }
         void            SetWorkPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_WORK, rPath ); }
+        void            SetClassificationPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_CLASSIFICATION, rPath ); }
 
         OUString   SubstVar( const OUString& rVar ) const;
         OUString   ExpandMacros( const OUString& rPath ) const;
@@ -202,7 +204,8 @@ static const PropertyStruct aPropNames[] =
     { "UserConfig",     SvtPathOptions::PATH_USERCONFIG     },
     { "Work",           SvtPathOptions::PATH_WORK           },
     { "UIConfig",       SvtPathOptions::PATH_UICONFIG       },
-    { "Fingerprint",    SvtPathOptions::PATH_FINGERPRINT    }
+    { "Fingerprint",    SvtPathOptions::PATH_FINGERPRINT    },
+    { "Classification", SvtPathOptions::PATH_CLASSIFICATION }
 };
 
 static const VarNameAttribute aVarNameAttribute[] =
@@ -584,6 +587,11 @@ const OUString& SvtPathOptions::GetWorkPath() const
     return pImp->GetWorkPath();
 }
 
+const OUString& SvtPathOptions::GetClassificationPath() const
+{
+    return pImp->GetClassificationPath();
+}
+
 void SvtPathOptions::SetAddinPath( const OUString& rPath )
 {
     pImp->SetAddinPath( rPath );
@@ -694,6 +702,11 @@ void SvtPathOptions::SetWorkPath( const OUString& rPath )
     pImp->SetWorkPath( rPath );
 }
 
+void SvtPathOptions::SetClassificationPath( const OUString& rPath )
+{
+    pImp->SetClassificationPath( rPath );
+}
+
 OUString SvtPathOptions::SubstituteVariable( const OUString& rVar ) const
 {
     return pImp->SubstVar( rVar );
@@ -778,6 +791,7 @@ bool SvtPathOptions::SearchFile( OUString& rIniFile, Paths ePath )
                 case PATH_WORK:         aPath = GetWorkPath();          break;
                 case PATH_UICONFIG:     aPath = GetUIConfigPath();      break;
                 case PATH_FINGERPRINT:  aPath = GetFingerprintPath();   break;
+                case PATH_CLASSIFICATION: aPath = GetClassificationPath(); break;
                 // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
                 case PATH_USERCONFIG:
                 case PATH_COUNT:


More information about the Libreoffice-commits mailing list