22#include <core_resource.hxx>
27#include <com/sun/star/container/XChild.hpp>
28#include <com/sun/star/container/XNameContainer.hpp>
33#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
34#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
35#include <com/sun/star/ucb/IOErrorCode.hpp>
36#include <com/sun/star/ucb/XDynamicResultSet.hpp>
37#include <com/sun/star/sdbc/XRow.hpp>
38#include <com/sun/star/task/InteractionHandler.hpp>
39#include <com/sun/star/task/InteractionClassification.hpp>
40#include <com/sun/star/sdbc/SQLException.hpp>
61 const OUString& _sDefaultName,
62 css::uno::Reference< css::uno::XComponentContext > _xContext)
63 : GenericDialogController(pParent,
"dbaccess/ui/collectionviewdialog.ui",
"CollectionView")
67 , m_xFTCurrentPath(m_xBuilder->weld_label(
"currentPathLabel"))
68 , m_xNewFolder(m_xBuilder->weld_button(
"newFolderButton"))
69 , m_xUp(m_xBuilder->weld_button(
"upButton"))
70 , m_xView(m_xBuilder->weld_tree_view(
"viewTreeview"))
71 , m_xName(m_xBuilder->weld_entry(
"fileNameEntry"))
72 , m_xPB_OK(m_xBuilder->weld_button(
"ok"))
76 m_xCmdEnv = new ::ucbhelper::CommandEnvironment(xHandler,
nullptr);
78 OSL_ENSURE(
m_xContent.is(),
"No valid content!");
84 m_xName->set_text(_sDefaultName);
99 OUString
sName = m_xName->get_text();
111 while( xNameAccess.is() )
113 xNameAccess.set(xChild->getParent(),UNO_QUERY);
114 if ( xNameAccess.is() )
126 OSL_ENSURE(xHier.is(),
"XHierarchicalNameContainer not supported!");
127 if ( !sSubFolder.isEmpty() && xHier.is() )
129 if ( xHier->hasByHierarchicalName(sSubFolder) )
131 m_xContent.set(xHier->getByHierarchicalName(sSubFolder),UNO_QUERY);
137 {
"ResourceName",
Any(sSubFolder)},
138 {
"ResourceType",
Any(OUString(
"folder"))}
141 InteractionClassification_ERROR,
142 IOErrorCode_NOT_EXISTING_PATH,aValues);
149 pRequest->addContinuation(pApprove);
150 xHandler->handle(pRequest);
157 if ( xNameContainer.is() )
159 if ( xNameContainer->hasByName(
sName) )
162 VclMessageType::Question, VclButtonsType::YesNo,
163 DBA_RES(STR_ALREADYEXISTOVERWRITE)));
164 if (xQueryBox->run() !=
RET_YES)
167 m_xName->set_text(
sName);
185 catch(
const SQLException& )
203 if ( xNameAccess.is() )
210 m_xUp->set_sensitive(
false);
224 if ( xNameAccess.is() )
226 OUString sSubFolder = m_xView->get_selected_text();
227 if (!sSubFolder.isEmpty())
230 if ( xNameAccess->hasByName(sSubFolder) )
231 xContent.set(xNameAccess->getByName(sSubFolder),UNO_QUERY);
251 bool bEnable =
false;
256 const OUString sCID =
m_xContent->getIdentifier()->getContentIdentifier();
257 static const char s_sFormsCID[] =
"private:forms";
258 static const char s_sReportsCID[] =
"private:reports";
262 sPath = sCID.copy(strlen(s_sFormsCID));
264 sPath = sCID.copy(strlen(s_sReportsCID) - 2);
275 m_xUp->set_sensitive(bEnable);
284#define ROW_IS_FOLDER 2
297 if (!xDynResultSet.is())
302 while (xResultSet->next())
uno::Reference< ucb::XContent > m_xContent
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
css::uno::Reference< css::uno::XComponentContext > m_xContext
void initCurrentPath()
sets the fixedtext to the right content
std::unique_ptr< weld::TreeView > m_xView
OCollectionView(weld::Window *pParent, const css::uno::Reference< css::ucb::XContent > &_xContent, const OUString &_sDefaultName, css::uno::Reference< css::uno::XComponentContext > _xContext)
css::uno::Reference< css::ucb::XContent > m_xContent
std::unique_ptr< weld::Entry > m_xName
std::unique_ptr< weld::Button > m_xPB_OK
virtual ~OCollectionView() override
std::unique_ptr< weld::Button > m_xUp
std::unique_ptr< weld::Label > m_xFTCurrentPath
css::uno::Reference< css::ucb::XCommandEnvironment > m_xCmdEnv
std::unique_ptr< weld::Button > m_xNewFolder
css::uno::Reference< css::ucb::XDynamicResultSet > createDynamicCursor(const css::uno::Sequence< OUString > &rPropertyNames, ResultSetInclude eMode=INCLUDE_FOLDERS_AND_DOCUMENTS)
std::shared_ptr< weld::Dialog > m_xDialog
Reference< XComponentContext > m_xContext
#define DBG_UNHANDLED_EXCEPTION(...)
#define LINK(Instance, Class, Member)
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
Reference< XComponentContext > getProcessComponentContext()
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
bool insertHierarchyElement(weld::Window *pParent, const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const css::uno::Reference< css::container::XHierarchicalNameContainer > &_xNames, const OUString &_sParentFolder, bool _bForm, bool _bCollection=true, const css::uno::Reference< css::ucb::XContent > &_xContent=nullptr, bool _bMove=false)
opens a save dialog to store a form or report folder in the current hierarchy.
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
Reference< XComponentContext > _xContext