summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-04-10 20:13:50 +0100
committerMichael Meeks <michael.meeks@suse.com>2013-04-10 20:13:50 +0100
commitb9e6d3cf5544f852e064696dde99dc3152d5038f (patch)
tree059ddff480d0fc664e5a7fc0770025341b7ecdd4
parentkill over-complicated 'alternatives' scheme for now. (diff)
downloadcore-b9e6d3cf5544f852e064696dde99dc3152d5038f.tar.gz
core-b9e6d3cf5544f852e064696dde99dc3152d5038f.zip
add lots of un-tested code to the GroupSlidesDialog.
Change-Id: Id4c30f23dbee676f65511204d85bbcb47bc74e1d
-rw-r--r--sd/source/ui/dlg/GroupSlidesDialog.cxx128
-rw-r--r--sd/source/ui/dlg/GroupSlidesDialog.hxx29
-rw-r--r--sd/uiconfig/simpress/ui/groupslides.ui30
3 files changed, 142 insertions, 45 deletions
diff --git a/sd/source/ui/dlg/GroupSlidesDialog.cxx b/sd/source/ui/dlg/GroupSlidesDialog.cxx
index d6c3cb2a69ba..0771d5a28756 100644
--- a/sd/source/ui/dlg/GroupSlidesDialog.cxx
+++ b/sd/source/ui/dlg/GroupSlidesDialog.cxx
@@ -7,55 +7,129 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include "slidehack.hxx"
#include "GroupSlidesDialog.hxx"
-#include <com/sun/star/graphic/GraphicProvider.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/componentcontext.hxx>
-
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
-#include <com/sun/star/drawing/XDrawPages.hpp>
-#include <com/sun/star/drawing/XDrawPage.hpp>
-#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-
-#include <sfx2/filedlghelper.hxx>
-#include <tools/urlobj.hxx>
-
-#include <unotools/pathoptions.hxx>
-#include <unotools/useroptions.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-
#include <vcl/msgbox.hxx>
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::presentation;
+using namespace ::SlideHack;
namespace sd
{
+namespace {
+ OriginDetailsPtr findLeadOrigin( const std::vector< SdPage * > &rPages )
+ {
+ for( size_t i = 0; i < rPages.size(); i++)
+ {
+ if ( rPages[i]->getOrigin().get() )
+ return rPages[i]->getOrigin();
+ }
+ return OriginDetailsPtr();
+ }
+}
+
+void SdGroupSlidesDialog::addGroupsToCombo( ComboBox *pBox, SdDrawDocument *pDoc )
+{
+ mpGroupCombo->Clear();
+
+ sal_uInt32 nPages = pDoc->GetSdPageCount( PK_STANDARD );
+ StorePtr pStore = SlideHack::Store::getStore();
+ OSL_ASSERT( pStore.get() );
+ for ( sal_uInt32 nPage = 0; nPage < nPages; ++nPage )
+ {
+ SdPage *pPage = pDoc->GetSdPage( nPage, PK_STANDARD );
+ OriginDetailsPtr pOrigin = pPage->getOrigin();
+ if ( !pOrigin.get() )
+ continue;
+ GroupPtr pGroup = pStore->lookupGroup( pOrigin );
+ if ( !pGroup.get() )
+ continue;
+ if ( std::find( maGroups.begin(), maGroups.end(), pGroup ) != maGroups.end() )
+ continue;
+ maGroups.push_back( pGroup );
+ mpGroupCombo->InsertEntry( pGroup->getMetaData()->getName() );
+ }
+}
+
SdGroupSlidesDialog::SdGroupSlidesDialog(Window* pWindow, SdDrawDocument* pActDoc,
const std::vector< SdPage * > &rPages )
- : ModalDialog(pWindow, "GroupSlidesDialog", "modules/simpress/ui/groupslides.ui"),
- pDoc(pActDoc),
+ : ModalDialog( pWindow, "GroupSlidesDialog", "modules/simpress/ui/groupslides.ui" ),
+ mpDoc( pActDoc ),
maPages( rPages )
{
- get(pCancelBtn, "cancel_btn");
- pCancelBtn->SetClickHdl(LINK(this, SdGroupSlidesDialog, CancelHdl));
+ get( mpAddBtn, "add_btn" );
+ get( mpCancelBtn, "cancel_btn" );
+ get( mpGroupCombo, "cb_group" );
+ get( mpTitle, "ed_title" );
+ get( mpKeywords, "ed_keywords" );
+
+ mpAddBtn->SetClickHdl( LINK( this, SdGroupSlidesDialog, AddHdl ) );
+ mpCancelBtn->SetClickHdl( LINK( this, SdGroupSlidesDialog, CancelHdl ) );
+
+ addGroupsToCombo( mpGroupCombo, mpDoc );
+ mpGroupCombo->SetSelectHdl( LINK( this, SdGroupSlidesDialog, GroupSelectHdl ) );
+ mpGroupCombo->SetDoubleClickHdl( LINK( this, SdGroupSlidesDialog, GroupDoubleClickHdl ) );
+ mpGroupCombo->EnableAutocomplete( true );
}
SdGroupSlidesDialog::~SdGroupSlidesDialog()
{
}
-IMPL_LINK_NOARG(SdGroupSlidesDialog, CancelHdl)
+IMPL_LINK_NOARG(SdGroupSlidesDialog, AddHdl)
{
+ fprintf(stderr, "Add to group\n");
EndDialog(0);
return 0;
}
+int SdGroupSlidesDialog::endDialog( bool bSuccessSoSave )
+{
+ if ( bSuccessSoSave )
+ {
+ sal_uInt16 nSelected = mpGroupCombo->GetSelectEntryPos();
+ fprintf( stderr, "complete: %d\n", (int) nSelected );
+ if ( nSelected < maGroups.size() )
+ {
+ fprintf( stderr, "one selected\n" );
+ }
+ else
+ {
+ fprintf( stderr, "new group\n" );
+ }
+ }
+
+ EndDialog(0);
+
+ return bSuccessSoSave ? 0 : 1;
+}
+
+void SdGroupSlidesDialog::populateEdits( GroupPtr pGroup )
+{
+ mpTitle->SetText( pGroup->getMetaData()->getTopic() );
+ mpKeywords->SetText( "fixme herrings pengins flippers" );
+}
+
+IMPL_LINK_NOARG( SdGroupSlidesDialog, CancelHdl )
+{
+ return endDialog( false ) ;
+}
+
+IMPL_LINK_NOARG( SdGroupSlidesDialog, GroupSelectHdl )
+{
+ sal_uInt16 nSelected = mpGroupCombo->GetSelectEntryPos();
+ OSL_ASSERT( nSelected < maGroups.size() );
+ fprintf( stderr, "select hdl %d\n", (int) nSelected );
+ populateEdits( maGroups[ nSelected ] );
+ return 0;
+}
+
+IMPL_LINK_NOARG( SdGroupSlidesDialog, GroupDoubleClickHdl )
+{
+ GroupSelectHdl( 0 );
+ return endDialog( true ) ;
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/GroupSlidesDialog.hxx b/sd/source/ui/dlg/GroupSlidesDialog.hxx
index ed5c9c8fb796..bf2ce35bd6f9 100644
--- a/sd/source/ui/dlg/GroupSlidesDialog.hxx
+++ b/sd/source/ui/dlg/GroupSlidesDialog.hxx
@@ -23,10 +23,17 @@
#include <vcl/graphicfilter.hxx>
#include <svx/svdotext.hxx>
+#include <slidehack.hxx>
+
class SdrTextObj;
class SdDrawDocument;
class SdPage;
+namespace SlideHack {
+ class Group;
+ typedef boost::shared_ptr< class Group > GroupPtr;
+}
+
namespace sd
{
@@ -38,12 +45,26 @@ public:
~SdGroupSlidesDialog();
private:
- CancelButton* pCancelBtn;
-
- SdDrawDocument* pDoc;
+ SdDrawDocument* mpDoc;
std::vector< SdPage * > maPages;
- DECL_LINK(CancelHdl, void*);
+ CancelButton *mpCancelBtn;
+ PushButton *mpAddBtn;
+
+ ComboBox* mpGroupCombo;
+ std::vector< SlideHack::GroupPtr > maGroups;
+ void addGroupsToCombo( ComboBox *pBox, SdDrawDocument *pDoc );
+
+ Edit *mpTitle;
+ Edit *mpKeywords;
+
+ DECL_LINK( AddHdl, void* );
+ DECL_LINK( CancelHdl, void* );
+ DECL_LINK( GroupSelectHdl, void* );
+ DECL_LINK( GroupDoubleClickHdl, void* );
+
+ int endDialog( bool bSuccessSoSave );
+ void populateEdits( SlideHack::GroupPtr pGroup );
};
}
diff --git a/sd/uiconfig/simpress/ui/groupslides.ui b/sd/uiconfig/simpress/ui/groupslides.ui
index bb209bc237ba..9b87ab2d8bf0 100644
--- a/sd/uiconfig/simpress/ui/groupslides.ui
+++ b/sd/uiconfig/simpress/ui/groupslides.ui
@@ -19,7 +19,7 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="create_btn">
+ <object class="GtkButton" id="add_btn">
<property name="label" translatable="yes">Add to group</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
@@ -112,7 +112,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="comboboxtext1">
+ <object class="GtkComboBoxText" id="cb_group">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -139,19 +139,11 @@
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkEntry" id="entry1">
+ <object class="GtkEntry" id="ed_title">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
+ <property name="placeholder_text">&lt;title for your group of slides&gt;</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -161,10 +153,11 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="entry2">
+ <object class="GtkEntry" id="ed_keywords">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
+ <property name="placeholder_text">&lt;topics and keywords for searching&gt;</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -173,6 +166,15 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>
@@ -299,7 +301,7 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">create_btn</action-widget>
+ <action-widget response="0">add_btn</action-widget>
<action-widget response="0">cancel_btn</action-widget>
</action-widgets>
</object>