summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-07-13 12:01:12 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-07-16 09:53:50 +0200
commit1abade4f92a6d1c70ab3e333770e1cb242f29063 (patch)
tree965b4b69956053b0d5363fa17a4e1130bd2386b8 /svtools
parent1c25093f8abf518e9983b9d23f6f3964001a1aac (diff)
moved the FolderTree class
Change-Id: I3231b32d3e3ade7dc3b366f03d6e189f5bc4d431
Diffstat (limited to 'svtools')
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/source/contnr/foldertree.cxx116
-rw-r--r--svtools/source/dialogs/RemoteFilesDialog.cxx113
3 files changed, 117 insertions, 113 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index e3ce0a0fa102..20a4c2ff2bb8 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -92,6 +92,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/contnr/DocumentInfoPreview \
svtools/source/contnr/contentenumeration \
svtools/source/contnr/fileview \
+ svtools/source/contnr/foldertree \
svtools/source/contnr/imivctl1 \
svtools/source/contnr/imivctl2 \
svtools/source/contnr/ivctrl \
diff --git a/svtools/source/contnr/foldertree.cxx b/svtools/source/contnr/foldertree.cxx
new file mode 100644
index 000000000000..b4c27fdbe0de
--- /dev/null
+++ b/svtools/source/contnr/foldertree.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <svtools/foldertree.hxx>
+
+#include "contentenumeration.hxx"
+
+FolderTree::FolderTree( vcl::Window* pParent, WinBits nBits )
+ : SvTreeListBox( pParent, nBits | WB_SORT | WB_TABSTOP )
+ , m_aFolderImage( SvtResId( IMG_SVT_FOLDER ) )
+{
+ Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ Reference< XInteractionHandler > xInteractionHandler(
+ InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW );
+ m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
+
+ SetDefaultCollapsedEntryBmp( m_aFolderImage );
+ SetDefaultExpandedEntryBmp( m_aFolderImage );
+}
+
+void FolderTree::RequestingChildren( SvTreeListEntry* pEntry )
+{
+ FillTreeEntry( pEntry );
+}
+
+void FolderTree::FillTreeEntry( SvTreeListEntry* pEntry )
+{
+ // fill only empty entries
+ if( pEntry && GetChildCount( pEntry ) == 0 )
+ {
+ ::std::vector< SortingData_Impl* > aContent;
+
+ FileViewContentEnumerator* pContentEnumerator = new FileViewContentEnumerator(
+ m_xEnv, aContent, m_aMutex, NULL );
+
+ OUString* pURL = static_cast< OUString* >( pEntry->GetUserData() );
+
+ if( pURL )
+ {
+ FolderDescriptor aFolder( *pURL );
+
+ EnumerationResult eResult =
+ pContentEnumerator->enumerateFolderContentSync( aFolder, m_aBlackList );
+
+ if ( SUCCESS == eResult )
+ {
+ for( unsigned int i = 0; i < aContent.size(); i++ )
+ {
+ if( aContent[i]->mbIsFolder )
+ {
+ SvTreeListEntry* pNewEntry = InsertEntry( aContent[i]->GetTitle(), pEntry, true );
+
+ OUString* sData = new OUString( aContent[i]->maTargetURL );
+ pNewEntry->SetUserData( static_cast< void* >( sData ) );
+ }
+ }
+ }
+ }
+ }
+}
+
+void FolderTree::SetTreePath( OUString sUrl )
+{
+ INetURLObject aUrl( sUrl );
+ aUrl.setFinalSlash();
+
+ OUString sPath = aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
+
+ SvTreeListEntry* pEntry = First();
+ bool end = false;
+
+ while( pEntry && !end )
+ {
+ if( pEntry->GetUserData() )
+ {
+ OUString sNodeUrl = *static_cast< OUString* >( pEntry->GetUserData() );
+
+ INetURLObject aUrlObj( sNodeUrl );
+ aUrlObj.setFinalSlash();
+
+ sNodeUrl = aUrlObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
+
+ if( sPath == sNodeUrl )
+ {
+ Select( pEntry );
+ end = true;
+ }
+ else if( sPath.startsWith( sNodeUrl ) )
+ {
+ if( !IsExpanded( pEntry ) )
+ Expand( pEntry );
+
+ pEntry = FirstChild( pEntry );
+ }
+ else
+ {
+ pEntry = NextSibling( pEntry );
+ }
+ }
+ else
+ break;
+ }
+}
+
+void FolderTree::SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList )
+{
+ m_aBlackList = rBlackList;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 41391e72528d..2eea4599ff2c 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -8,119 +8,6 @@
*/
#include <svtools/RemoteFilesDialog.hxx>
-#include "../contnr/contentenumeration.hxx"
-
-class FolderTree : public SvTreeListBox
-{
-private:
- Reference< XCommandEnvironment > m_xEnv;
- ::osl::Mutex m_aMutex;
- Sequence< OUString > m_aBlackList;
- Image m_aFolderImage;
-
-public:
- FolderTree( vcl::Window* pParent, WinBits nBits )
- : SvTreeListBox( pParent, nBits | WB_SORT | WB_TABSTOP )
- , m_aFolderImage( SvtResId( IMG_SVT_FOLDER ) )
- {
- Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- Reference< XInteractionHandler > xInteractionHandler(
- InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW );
- m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
-
- SetDefaultCollapsedEntryBmp( m_aFolderImage );
- SetDefaultExpandedEntryBmp( m_aFolderImage );
- }
-
- virtual void RequestingChildren( SvTreeListEntry* pEntry )
- {
- FillTreeEntry( pEntry );
- }
-
- void FillTreeEntry( SvTreeListEntry* pEntry )
- {
- // fill only empty entries
- if( pEntry && GetChildCount( pEntry ) == 0 )
- {
- ::std::vector< SortingData_Impl* > aContent;
-
- FileViewContentEnumerator* pContentEnumerator = new FileViewContentEnumerator(
- m_xEnv, aContent, m_aMutex, NULL );
-
- OUString* pURL = static_cast< OUString* >( pEntry->GetUserData() );
-
- if( pURL )
- {
- FolderDescriptor aFolder( *pURL );
-
- EnumerationResult eResult =
- pContentEnumerator->enumerateFolderContentSync( aFolder, m_aBlackList );
-
- if ( SUCCESS == eResult )
- {
- for( unsigned int i = 0; i < aContent.size(); i++ )
- {
- if( aContent[i]->mbIsFolder )
- {
- SvTreeListEntry* pNewEntry = InsertEntry( aContent[i]->GetTitle(), pEntry, true );
-
- OUString* sData = new OUString( aContent[i]->maTargetURL );
- pNewEntry->SetUserData( static_cast< void* >( sData ) );
- }
- }
- }
- }
- }
- }
-
- void SetTreePath( OUString sUrl )
- {
- INetURLObject aUrl( sUrl );
- aUrl.setFinalSlash();
-
- OUString sPath = aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
-
- SvTreeListEntry* pEntry = First();
- bool end = false;
-
- while( pEntry && !end )
- {
- if( pEntry->GetUserData() )
- {
- OUString sNodeUrl = *static_cast< OUString* >( pEntry->GetUserData() );
-
- INetURLObject aUrlObj( sNodeUrl );
- aUrlObj.setFinalSlash();
-
- sNodeUrl = aUrlObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
-
- if( sPath == sNodeUrl )
- {
- Select( pEntry );
- end = true;
- }
- else if( sPath.startsWith( sNodeUrl ) )
- {
- if( !IsExpanded( pEntry ) )
- Expand( pEntry );
-
- pEntry = FirstChild( pEntry );
- }
- else
- {
- pEntry = NextSibling( pEntry );
- }
- }
- else
- break;
- }
- }
-
- void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList )
- {
- m_aBlackList = rBlackList;
- }
-};
class FileViewContainer : public vcl::Window
{